<?php

/**
 * @author barbarosalcin
 * @desc advert box
 * @version $Id: 20100617
 * @package modules
 */

unset($module_data);
foreach ( $this->page->_pm as $key => $value )
{
	if ((int) $value)
	{
		$tmp_a[] = $value;
	}
}

$tmp_a = implode(',',$tmp_a);

$sql = "SELECT SQL_CACHE id,content,adverttype FROM " . ADVERTS_TABLE . " 
WHERE status = 1 AND (expiretime = 0 OR expiretime > '{$config['time']}') AND id IN ($tmp_a)";

$result = $this->db->sql_query($sql);
unset($tmp_a);

$row = $this->db->sql_fetchrowset($result);

foreach($row as $key=>$value)
{
	$tmp_a = array_keys($this->page->_pm,$value['id']);
	foreach($tmp_a as $v)
	{
		$module_data[$v] = $value;
	}
}

return $module_data;


